// 环境类型枚举
import 'dart:io';

import 'package:demo/common/utils/debug_util.dart';
import 'package:demo/config/platform_config.dart';

enum Environment {
  dev, //测试
  pre, //正式环境测试
  release, //正式
}

// 开发环境配置
final EnvConfig dev = EnvConfig(
  environment: Environment.dev,
  appName: 'dev Demo',
  apiUrl: '替换',
  isDebug: true,
);

// 正式-测试阶段环境配置
final EnvConfig pre = EnvConfig(
  environment: Environment.pre,
  appName: 'pre demo',
  apiUrl: '替换',
  isDebug: true,
);

// 正式环境配置
final EnvConfig release = EnvConfig(
  environment: Environment.release,
  appName: 'demo',
  apiUrl: '替换',
  isDebug: false,
);

const androidConfig = PlatformConfig(appId: '替换', apiSignKey: '替换');

const iosConfig = PlatformConfig(appId: '替换', apiSignKey: '替换');

PlatformConfig get platformConfig {
  if (Platform.isAndroid) {
    return androidConfig;
  } else {
    return iosConfig;
  }
}

EnvConfig get envConfig {
  if (DebugUtil.isForceDebug()) return pre;
  return DebugUtil.isDebug() ? dev : release;
}

// 环境配置类
class EnvConfig {
  final Environment environment;
  final String appName;
  final String apiUrl;
  final bool isDebug;

  EnvConfig({required this.environment, required this.appName, required this.apiUrl, required this.isDebug});
}
